<template>
    <div class="project-charts">
        <div class="charts-item">
            <common-title>
                项目进度占比
            </common-title>
            <div class="charts-box">
                <ve-ring :data="chartData" :settings="chartSettings" :legend-visible="false" width="100%" height="100%" style="position: relative;top:35px;"></ve-ring>
                <div class="label-list">
                    <div class="label-item" v-for="(item, i) in labelList" :key="i">
                        <div class="top">
                            <span class="label-icon" :class="`label-icon-${i}`"></span>{{item.label}}
                        </div>
                        <span class="num">{{item.num}}</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="charts-item">
            <common-title>
                工人总数统计
            </common-title>
            <ve-histogram 
            :data="chartData"
            :legend-visible="false"
            :settings="settings"
            :extend="extendss"
            :options="optionss"
            xAxisType="value"
            :judge-width="true"
            :min="0"
            :max="10"
            ref="echarts"
            height="100%"
            width="100%"
            ></ve-histogram>
        </div>
    </div>
</template>
<script>
import {VeRing, } from 'v-charts'
export default {
    name: 'homeProjectCharts',
    components: {
        VeRing
    },
    data () {
    this.chartSettings = {
        radius: [30, 60],
        labelLine: {
          show: false
        },
        label: {
          show: false
        },
        offsetY: 90
    }
    this.settings = {
        itemStyle: {
            color: '#3CA0FF'
        },
        label: {
            show: true,		//开启显示
            position: 'top',	//在上方显示
            textStyle: {	    //数值样式
                color: '#0467E0',
                fontSize: 12
            }
        }
        }
    this.extendss = {
        barWidth: 30,
        yAxis: {
                minInterval: 1
            }
    }
    this.optionss = {
        xAxis: {
            nameTextStyle: {
                color: '#f00',
                fontSize: '10'
            }
        }
    }
    return {
      chartData: {
        columns: ['日期', '访问用户'],
        rows: [
          { '日期': '1/1', '访问用户': 1393 },
          { '日期': '1/2', '访问用户': 3530 },
          { '日期': '1/3', '访问用户': 2923 }
        ]
      },
      labelList: [
          {
              label: '在建(个)',
              num: '5'
          },
          {
              label: '未开始(个)',
              num: '5'
          },
          {
              label: '已结束(个)',
              num: '5'
          }
      ]
    }
  }
}
</script>
<style lang="less" scoped>
.project-charts {
    width: 100%;
    overflow: hidden;
    .charts-item {
        background: #fff;
        float:left;
        width: calc(33.33% - 6.667px);
        margin-right: 10px;
        height: 366px;
        padding-bottom: 30px;
        &:last-child {
            width: calc(66.66% - 3.332px);
            margin-right: 0;
        }
        .charts-box {
            width: 100%;
            height: 100%;
            overflow:hidden;
            position: relative;
            .label-list {
                position: absolute;
                width: 100%;
                bottom: 40px;
                left: 0;
                display:flex;
                text-align: center;
                .label-item {
                    flex: 1;
                    font-size: 14px;
                    color: #666;
                    .label-icon {
                        display: inline-block;
                        border: 4px solid transparent;
                        border-radius: 50%;
                        width: 12px;
                        height: 12px;
                        vertical-align: middle;
                        margin-right: 5px;
                        &.label-icon-0 {
                            border-color: #1298FC;
                        }
                        &.label-icon-1 {
                            border-color: #FEB400;
                        }
                        &.label-icon-2 {
                            border-color: #FF528A;
                        }
                    }
                    .num {
                        font-size: 24px;
                        color: #333;
                    }
                }
            }
        }
    }
}
</style>